<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ include file="header.jsp" %>
<div class="templatemo-body">
    <div class="container">
        <div class="col-md-12">
            <form action="Book_search_Action.action">
                <input type="text" name="key"/><input type="submit" value="搜索"/>
            </form>
        </div>
        <div class="col-md-12"
             style="padding-left: 0px;margin-top:10px;border: 1px solid  #e3e0e0;">
            <!-- 定义一个Comparator实例 -->
            <s:if test="book_list.{?#this.flag==1}.size()>0">

                <s:bean var="mydecider" name="until.MyDecider">
                    <s:param name="par" value="key"/>
                </s:bean>
                <s:bean var="mycomparator" name="until.CusComparator"/>

                <!-- 使用自定义的排序规则对目标集合进行排序 -->
                <s:sort source="book_list.{?#this.flag==1}"
                        comparator="#mycomparator" var="sortedList"/>
                <s:subset source="#attr.sortedList" decider="#mydecider"
                          var="newList"/>
                <s:iterator value="#attr.newList" var="bklist" status="st">
                    <div
                            style="float: left; width: 220px;height:260px; padding-left: 10px; padding-right: 10px; border-bottom: 1px dashed  #e3e0e0;">
                        <div>
                            <img
                                    src="images/product_img/<s:property value="#bklist.getImage()" />.jpg"/>
                        </div>
                        <div class="bookname" style="text-align:left;">
                            <p>
                                <a href='#' target="_blank"
                                   style="font-size: 14px; font-bolder:bold;"><s:property
                                        value="#bklist.getBookName()"/></a>
                            </p>
                        </div>
                        <div class="bookprice">
                            <s:property value="#bklist.getPrice()"/>
                            元<span>￥<s:property value="#bklist.getPrice()"/>元
							</span>
                        </div>
                        <div class="bookbuy">
                            <li><a href='Book_Delete_Action.action?id=<s:property value="#bklist.getBookId()" />'><span>删除</span></a>

                                <a href='Book_Get_Action.action?id=<s:property value="#bklist.getBookId()" />'><span>修改></span></a>
                            </li>
                        </div>
                    </div>

                </s:iterator>
            </s:if>
            <div class="bookimage">
                <s:file name="img"/>
            </div>
        </div>
    </div>
</div>
</body>
</html>